#if !defined(TAB_DELIMITED_STR_H)
#define TAB_DELIMITED_STR_H
#include <string>
#include <istream>

// Read tab delimited strings in the manner of c++ stream extraction operators
//	without consuming terminal whitespace.
// A bit safer: can specify initial delimiter which may or may not be present.
// Returns terminal delimiter (can be tab or new line)
std::string read_char_delimited_str(std::istream& istrm, char initial_delimiter, char& end_delimiter);

struct tab_delimited_str
{
	const char initial_c;
	mutable std::string& str;
	mutable char& end_c;
	tab_delimited_str(char initial_c_, std::string& str_, char& c_):
		initial_c(initial_c_), str(str_), end_c(c_){}
};

inline std::istream& operator >> (std::istream& is, const tab_delimited_str& o)
{
	o.str = read_char_delimited_str(is, o.initial_c, o.end_c);
	return is;
}
#endif
